
var addFormWindow = null;
//打开更新窗口的函数
var openUpdateWindow = null;
//分页插件
var jqp = null;
//初始化分页
$(function () {
        jqp = $.jqPaginator('#pagination', {
        visiblePages: 10,
        currentPage: pageNumber,
        pageSize: pageSize,
        totalCounts: totalCount,
        onPageChange: function (num, type) {
            if(num != pageNumber)
            	window.location.href = getPath() + "base/user/list/" + num +"/"+pageSize + ($("#isFilter").val() == 1 ? ("?" + $("#searchForm").serialize()) : "");
        }
    });

	    setGridListCheckBox("userTable");//点击全选,判断是全选还是取消全选,判断当前情况是否为全选的情况
	    setSearchBtnClick("base/user/list/1/"+pageSize+"?");//搜索
	    setAddBtnClick("base/user/add",{dialogId:'dialog'});
		gridDataDelete('base/user/delete/',{
			multiple:true,
			tableId:'userTable',
			successUrl:"base/user/list/1/"+pageSize
		});//多选删除

		//刷新用户缓存
		$("#refreshCacheBtn").click(function(){
			 createWindow('确定要刷新缓存？',{
                 cancleEnable:true,
                 callBack:function(){
                 	$("#loadDiv").loading().showLoading();
                 	post(getPath()+"refreshUserCache",{},function(result){
        				if(result=="isSuccess"){
        					$("#loadDiv").loading().hideLoading();
        					createWindow("缓存刷新成功",{url:getPath() + "base/user/list/1/"+pageSize}).dialog("open");
        				}
        			});
                 }
             }).dialog('open');
		});


//     selectAll("userTable");//点击全选,判断是全选还是取消全选
//     changTrCss("userTable");//复选框选择改变，设置此行的样式，并判断当前情况是否为全选的情况
//     changeTrCheckboxStatu("userTable");//点击一行，改变这行的复选框勾选
//     searchBtnClick("base/user/list/1/"+pageSize+"?");//点击查询
//     addBtnClick("base/user/add");//打开添加窗口
//     editBtnClick("userTable","base/user/edit/");
//     deleteData("userTable","base/user/delete/","base/user/list/1/"+pageSize,140);//删除数据
//     deleteData("userTable","/base/user/delete/","base/user/list/1/"+pageSize,140);//删除数据
     //去除所有控件的虚线框
	 removeBlur();
});

//首位为字母的数字字母组合
function isUserNameValidator(){
    jQuery.validator.addMethod("userNameValidate", function(value,element) {
        if(value){
            var name = /^[a-zA-Z]{1}[0-9a-zA-Z]{3,19}$/;
            return this.optional(element) || (name.test(value));
        }else{
            return true;
        }
    }, "请填写符合格式的用户名");
}